﻿/// Write methods to calculate minimum, maximum, average, sum and product of given set of integer numbers.
/// Use variable number of arguments.


using System;
using System.Text;

class MaxMinAvgSumProduct
{
    static void Main()
    {
        Console.WriteLine("Min={0}", GetMin(1, 2, 3, 4));
        Console.WriteLine("Max={0}", GetMax(1, 2, 3, 4));
        Console.WriteLine("Avg={0}", CalcAvg(1, 2, 3, 4));
        Console.WriteLine("Sum={0}", FindSum(1, 2, 3, 4));
        Console.WriteLine("Product={0}", FindProduct(1, 2, 3, 4));
        Console.WriteLine();
    }
    
    
    static int GetMax(params int[] arr)
    {
        int maxmimum = arr[0];

        for (int i = 0; i < arr.Length; i++)
        {
            if (arr[i] > maxmimum)
            {
                maxmimum = arr[i];
            }
        }
        return maxmimum;
    }

    static int GetMin(params int[] arr)
    {
        int minimum = arr[0];

        for (int i = 0; i < arr.Length; i++)
        {
            if (arr[i] < minimum)
            {
                minimum = arr[i];
            }
        }

        return minimum;
    }

    static decimal CalcAvg(params int[] arr)
    {
        decimal sum = 0;
        
        for (int i = 0; i < arr.Length; i++)
        {
            sum += arr[i];
        }

        return sum / 2;
    }

    static int FindSum(params int[] arr)
    {
        int sum = 0;
        foreach (var number in arr)
        {
            sum += number;
        }
        return sum;
    }
    static int FindProduct(params int[] arr)
    {
        int product = 1;
        foreach (var number in arr)
        {
            product *= number;
        }
        return product;
    }
    
}